﻿using UnityEngine;
using System.Collections;

public class Pipeline : MonoBehaviour {

	public float speed ;
	public Vector2 HighRange ;
	private float time=0f;

	// Use this for initialization
	void Start () {
		Init ();
	}
	
	// Update is called once per frame
	void Update () {
		transform.localPosition += new Vector3 (-speed * Time.deltaTime, 0,0);
		time += Time.deltaTime;
		if (time > 4.5f)
		{
			Init();
			time=0;
		}
	}

	public void Init()
	{
		transform.localPosition = new Vector2 (0, Random.Range (HighRange.x, HighRange.y));
	}
}
